package com.stem.sms.authenticator.ali;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

/**
 * @author zhang
 * @create 2019-08-29 15:00
 * @desc 阿里短信配置信息
 */
class SystemConfigProperties {


    static IAcsClient defaultProfile() {
        //阿里 SecretKey
        String secretKey = "xxxxxxxxxxxxxx";
        //阿里AccessKey
        String accessKey = "xxxxxxxxxxxxxx";
        return new DefaultAcsClient(DefaultProfile.getProfile("default", accessKey, secretKey));
    }

    static CommonRequest commonRequest() {

        //短信服务的服务接入地址
        String domain = "dysmsapi.aliyuncs.com";
        //短信API 的版本号
        String version = "2017-05-25";
        //要调用的API
        String action = "SendSms";
        //短信签名
        String smsSignName = "xxxxxxxxxxxxxx";
        //短信模板
        String smsCaptchaTemplate = "xxxxxxxxxxxxxx";
        CommonRequest request = new CommonRequest();
        request.setMethod(MethodType.POST);
        request.setDomain(domain);
        request.setVersion(version);
        request.setAction(action);
        request.putQueryParameter("SignName", smsSignName);
        request.putQueryParameter("TemplateCode", smsCaptchaTemplate);

        return request;
    }
}
